package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.UserRegDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {

    @ResponseBody
    @RequestMapping("/v1/users/login")
    public String login(){
        return "<h1 style="+"color:red"+">恭喜你，登录成功</h1>";
    }

    @ResponseBody
    @RequestMapping("/v1/users/reg1")
    public String reg1(HttpServletRequest request){
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        return username+"----"+password;
    }


    @ResponseBody
    @RequestMapping("/v1/users/reg2")
    public String reg2(String username,String password){
        return username+":::"+password;

    }

    @ResponseBody
    @RequestMapping("/v1/users/reg3")
    public String reg3(UserRegDTO userRegDTO){
        String username = userRegDTO.getUsername();
        String password = userRegDTO.getPassword();

        return username+"--------->"+password;
    }

}
